package cn.edu.xjtu.data_structure.experiment.ex_3;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/11/20 22:52
 */
public class BinNode<K extends Comparable<K>, V> {
    private K key;
    private V value;

    private BinNode<K, V> left;
    private BinNode<K, V> right;

    public BinNode(K key, V value){
        left = right = null;
        this.key=key;
        this.value=value;
    }

    public BinNode() {
    }

    public boolean isLeaf() {
        return left == null && right == null;
    }

    public K getKey() {
        return key;
    }

    public void setKey(K key) {
        this.key = key;
    }

    public V getValue() {
        return value;
    }

    public void setValue(V value) {
        this.value = value;
    }

    public BinNode<K, V> getLeft() {
        return left;
    }

    public void setLeft(BinNode<K, V> left) {
        this.left = left;
    }

    public BinNode<K, V> getRight() {
        return right;
    }

    public void setRight(BinNode<K, V> right) {
        this.right = right;
    }
}

